class Solution
{
public:
    string removeDuplicates(string s)
    {
        string ret;

        for (char ch : s)
        {
            if (ret.size() && ret.back() == ch) ret.pop_back();
            else ret += ch;
        }
        return ret;
    }
};